<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['设备安装管理','设备安装记录']" icon="fa fa-wrench" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span><h2>设备安装记录</h2></header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<div class="top_module">																	 							
									<span class="module_text">公司名称</span>	
									<sa-company-tree companyTreeId="companyTree" (companySelected)="companySelected($event)"></sa-company-tree>										
								</div>
								<div class="top_module">
									<span class="module_text">用户名</span>
									<div class="s_hover_box">
										<select   class="select2"  id="userNameSelect2">
											<option value=''></option>
										</select>
										<div class="s_del_icon" (click)='delUserName()'>x</div>
									</div>
								</div>
								<div class="top_module top_module_box">
									<span class="top_module_label module_text">数据来源</span>
									<select name="" class="top_module_select" [(ngModel)]="dataSource">
									  <option value="">全部</option>
									  <option value="0">安装</option>
									  <option value="1">移机</option>
									</select>
								</div>
								<div class="selectDate top_module">
									<div class="input-daterange input-group s_selected_time_box s_hover_box">
										<input type="text" [(ngModel)]='startTime' class="form-control s_selected_time" id="datetimepicker1"  autocomplete="off" placeholder="选择开始时间"/>
										<span class="s_selected_time_spe">至</span>
										<input type="text" [(ngModel)]='endTime' class="form-control s_selected_time" id="datetimepicker2"  autocomplete="off" placeholder="选择结束时间"/>
										<div class="s_del_icon" (click)='del_date()'>x</div>
									</div>
								</div>
								
								<button  type="button"  class="btn btn-primary" (click)="table_search()">查询</button>
								<button  type="button"  class="btn btn-primary" (click)="new_record()" *ngIf="deviceAdd">添加</button>
								<button  type="button"  class="btn btn-primary" (click)="dataShow(BarModal,5)">近五天</button>
								<button  type="button"  class="btn btn-primary" (click)="dataShow(BarModal,10)">近十天</button>
								<button  type="button"  class="btn btn-primary" (click)="dataShow(BarModal,30)">近一个月</button>
								<button type="button" class="btn btn-primary" (click)="exportData()">导出</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input" placeholder="车牌号,用户名...">
								<span class="top-search-box">
							        <button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
							    </span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>操作</th>
										<th>设备ID</th>
										<th>车牌号码</th>
										<th>打磨清洗</th>
										<th>贴片</th>
										<th>封胶</th>
										<th>穿线</th>
										<th>主机</th>
										<th>数据来源</th>
										<th>开始安装时间</th>
										<th>安装完成时间</th>
										<th>安装时长</th>
										<th>安装地址</th>
										<th>录入人员</th>
										<th>是否审核</th>
										<th>审核人员</th>
										<th>审核时间</th>
										<th>审核意见</th>
										<!-- <th>图片</th> -->
										<th *ngIf='deviceDelete||deviceAudit'>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData" >
										<td>
											<button type="button" (click)="updata_record(row)" *ngIf='deviceEdit'>编辑</button>
											<button type="button" (click)="open_img(row,ImgModal)" *ngIf="row.imageInfo != null && row.imageInfo.length !=0">图片</button>
										</td>
										<td>{{row.deviceId}}</td>
										<td>{{row.carNumber}}</td>
										<td>{{row.polishInstallerName}}</td>
										<td>{{row.patchInstallerName}}</td>
										<td>{{row.sealantInstallerName}}</td>
										<td>{{row.threadingInstallerName}}</td>
										<td>{{row.hostInstallerName}}</td>
										<td>
											<span *ngIf="row.dataSource === 0">安装</span>
								            <span *ngIf="row.dataSource === 1">移机</span>
										</td>
										<td>{{row.startInstallTime}}</td>
										<td>{{row.installTime}}</td>
										<td>{{row.passTimeForInstall}}</td>
										<td>{{row.installAddress}}</td>
										<td>{{row.recorder}}</td>
										<td>
										 	<span *ngIf="row.auditStatus === 0" class="orange">未审核</span>
								            <span *ngIf="row.auditStatus === 1" class="green">审核通过</span>
								            <span *ngIf="row.auditStatus === 2" class="red">审核不通过</span>
										</td>
										<td>{{row.auditorUser}}</td>
										<td>{{row.auditorTime}}</td>
										<td>{{row.remark}}</td>
										<!-- <td> -->
											<!-- <button type="button" (click)="open_img(row,ImgModal)" *ngIf="row.imagePath">查看</button> -->
											<!-- <button type="button" (click)="open_img(row,ImgModal)" *ngIf="row.imageInfo != null && row.imageInfo.length !=0">图片</button> -->
										<!-- </td> -->
										<td *ngIf='deviceDelete||deviceAudit'>
											<!-- <button type="button" (click)="updata_record(row)" *ngIf='deviceEdit'>编辑</button> -->
											<button type="button" (click)="del_record(row)" *ngIf='deviceDelete'>删除</button>
											<button type="button" (click)="audit_Record(row,auditModal)" *ngIf='deviceAudit'>审核</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount"
						           [rows]="pageSize"
						           [currentPage]="curPage - 1"
						           (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	<!-- 审核    弹窗-->
	<div bsModal #auditModal="bs-modal" id="resetOrderModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="cancelAudit(auditModal)" aria-label="Close">
	            <span aria-hidden="true">&times;</span>
	          </button>
					<h4 class="modal-title">设备安装审核</h4>
				</div>
				<div class="modal-body">
					<div class="row form-horizontal">
						<div class="form-group col-xs-12">
							<label class="control-label col-xs-4 col-sm-2">审核状态<sup>*</sup></label>
							<div class="col-xs-10">
								<label class="radio radio-inline">
									<input type="radio" class="radiobox" [(ngModel)]='auditStatus' (change)="auditStatusChange($event.target.value)" value='1' name="auditPass">
									<span>审核通过</span>
								</label>
								<label class="radio radio-inline">
									<input type="radio" class="radiobox" [(ngModel)]='auditStatus' (change)="auditStatusChange($event.target.value)" value='2' name="auditNoPass">
									<span>审核不通过</span>
								</label>
							</div>
						</div>
						<div class="form-group col-xs-12">
							<label class="control-label col-xs-4 col-sm-2">审核意见</label>
							<div class="col-xs-10">
								<textarea class="form-control" [(ngModel)]='remark' rows="3" cols="30" placeholder="填写审核意见..."></textarea>
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="cancelAudit(auditModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="auditSubmit(auditModal)">确认</button>
				</div>
			</div>
		</div>
	</div>
	<!--审核  end-->
	<!-- 图片查看   弹窗-->
	<section bsModal #ImgModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg" style="width: 1000px;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="imgClose(ImgModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>     
					<h4 class="modal-title">图片<span *ngIf='carNumber'>-[{{carNumber}}]</span></h4>
				</div>
				<div class="modal-body" style="padding: 0 20px 20px 20px">
					<div class="row form-horizontal imagesInfo" *ngIf='imgInfo.length != 0'>
						<div class="imagesList imagesList-sensor">
							<div *ngFor="let item of imgInfo">
								<div class="imgFileList" *ngIf='item.index == 1'>
									<label class="imgTitle">车辆正面</label>
									<div class="imgContList">
										<div class="imgCont" *ngFor="let row of item.localImg" (click)="bigimg(row)">
											<img class="imgSrc" [src]="row" alt="车辆正面"/>
										</div>
									</div>
								</div>
								<div class="imgFileList" *ngIf='item.index != 1' style="display: none;"></div>
							</div>
						</div>
						<div class="imagesList imagesList-sensor">
							<div *ngFor="let item of imgInfo">
								<div class="imgFileList" *ngIf='item.index == 2'>
									<label class="imgTitle">车辆侧面</label>
									<div class="imgContList">
										<div class="imgCont" *ngFor="let row of item.localImg" (click)="bigimg(row)">
											<img class="imgSrc" [src]="row" alt="车辆侧面"/>
										</div>
									</div>
								</div>
								<div class="imgFileList" *ngIf='item.index != 2' style="display: none;"></div>
							</div>
						</div>
						<div class="imagesList imagesList-sensor">
							<div *ngFor="let item of imgInfo">
								<div class="imgFileList" *ngIf='item.index == 3'>
									<label class="imgTitle">主机</label>
									<div class="imgContList">
										<div class="imgCont" *ngFor="let row of item.localImg" (click)="bigimg(row)">
											<img class="imgSrc" [src]="row" alt="主机"/>
										</div>
									</div>
								</div>
								<div class="imgFileList" *ngIf='item.index != 3' style="display: none;"></div>
							</div>
						</div>
						<div class="imagesList imagesList-sensor">
							<div *ngFor="let item of imgInfo">
								<div class="imgFileList" *ngIf='item.index == 5'>
									<label class="imgTitle">天线</label>
									<div class="imgContList">
										<div class="imgCont" *ngFor="let row of item.localImg" (click)="bigimg(row)">
											<img class="imgSrc" [src]="row" alt="天线"/>
										</div>
									</div>
								</div>
								<div class="imgFileList" *ngIf='item.index != 5' style="display: none;"></div>
							</div>
						</div>
						<div class="imagesList imagesList-sensor">
							<div *ngFor="let item of imgInfo">
								<div class="imgFileList" *ngIf='item.index == 4'>
									<label class="imgTitle">传感器</label>
									<div class="imgContList">
										<div class="imgCont" *ngFor="let row of item.localImg" (click)="bigimg(row)">
											<img class="imgSrc" [src]="row" alt="传感器"/>
										</div>
									</div>
								</div>
								<div class="imgFileList" *ngIf='item.index != 4' style="display: none;"></div>
							</div>
						</div>
						<div class="imagesList imagesList-sensor">
							<div *ngFor="let item of imgInfo">
								<div class="imgFileList" *ngIf='item.index == 7'>
									<label class="imgTitle">电源</label>
									<div class="imgContList">
										<div class="imgCont" *ngFor="let row of item.localImg" (click)="bigimg(row)">
											<img class="imgSrc" [src]="row" alt="电源"/>
										</div>
									</div>
								</div>
								<div class="imgFileList" *ngIf='item.index != 7' style="display: none;"></div>
							</div>
						</div>
						<div class="imagesList imagesList-sensor">
							<div *ngFor="let item of imgInfo">
								<div class="imgFileList" *ngIf='item.index == 8'>
									<label class="imgTitle">行驶证</label>
									<div class="imgContList">
										<div class="imgCont" *ngFor="let row of item.localImg" (click)="bigimg(row)">
											<img class="imgSrc" [src]="row" alt="行驶证"/>
										</div>
									</div>
								</div>
								<div class="imgFileList" *ngIf='item.index != 8' style="display: none;"></div>
							</div>
						</div>
						<div class="imagesList imagesList-sensor">
							<div *ngFor="let item of imgInfo">
								<div class="imgFileList" *ngIf='item.index == 9'>
									<label class="imgTitle">付款凭证</label>
									<div class="imgContList">
										<div class="imgCont" *ngFor="let row of item.localImg" (click)="bigimg(row)">
											<img class="imgSrc" [src]="row" alt="付款凭证"/>
										</div>
									</div>
								</div>
								<div class="imgFileList" *ngIf='item.index != 9' style="display: none;"></div>
							</div>
						</div>
						<div class="imagesList imagesList-other">
							<div *ngFor="let item of imgInfo">
								<div class="imgFileList" *ngIf='item.index == 6'>
									<label class="imgTitle">其他</label>
									<div class="imgContList">
										<div class="imgCont" *ngFor="let row of item.localImg" (click)="bigimg(row)">
											<img class="imgSrc" [src]="row" alt="其他"/>
										</div>
									</div>
								</div>
								<div class="imgFileList" *ngIf='item.index != 6' style="display: none;"></div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</section>
	<!-- 图片查看 弹窗end-->
	
	<!-- 统计图   弹窗-->
	<section bsModal #BarModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="barClose(BarModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>     
					<h4 class="modal-title">设备安装记录统计</h4>
				</div>
				<div class="modal-body">
					<div class="row form-horizontal">
						<div id="chart_bar" style="width:590px;height: 360px;"></div>
					</div>
				</div>
			</div>
		</div>
	</section>
	<!-- 统计图 弹窗end-->
	
</div>
<style type="text/css">
	.picture{
		min-height: 100px;
		width: 100%;
		height: auto;
	}
</style>